Find the median of three valuesΒΆ
Find the median of three values.
Expected output:
Input first number: 15
Input second number: 26
Input third number: 29
The median is 26.0
a = float(input("Input first number: "))
b = float(input("Input second number: "))
c = float(input("Input third number: "))
if a > b:
if a < c:
median = a
elif b > c:
median = b
else:
median = c
else:
if a > c:
median = a
elif b < c:
median = b
else:
median = c
print("The median is", median)
Output:
Input first number: 25
Input second number: 55
Input third number: 65
The median is 55.0